import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class UsedRentplaneManageService {

  serviceUrls: any = {
    queryNewMachineListUrl: '/newMachine/list', // 租机机器管理-List
    queryNewMachineInfoUrl: '/newMachine/info/', // 租机机器管理-详情
    saveNewMachineUrl: '/newMachine/save', // 租机机器管理-保存
    exportNewMachineUrl: '/newMachine/export' // 租机机器管理-导出
  };

  constructor(public httpClient: HttpClient) { }

  // 查询租机机器管理List
  queryNewMachineList(params: any) {
    return this.httpClient.get(this.serviceUrls.queryNewMachineListUrl, { params }).toPromise();
  }

  // 租机机器管理-详情
  queryNewMachineDetails(id: number | string) {
    return this.httpClient.get(`${this.serviceUrls.queryNewMachineInfoUrl}${id}`).toPromise();
  }

  // 租机机器管理-保存
  saveNewMachineData(params: any) {
    return this.httpClient.post(this.serviceUrls.saveNewMachineUrl, params).toPromise();
  }

  // 机器机器管理-导出
  exportNewMachineData(params: any) {
    return this.httpClient.get(this.serviceUrls.exportNewMachineUrl, { params, responseType: 'blob' }).toPromise();
  }
}



